package com.daxiong.hfs;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.daxiong.hfs.bean.CompanyBean;
import com.daxiong.hfs.bean.MainBean;
import com.daxiong.hfs.util.CommonUtil;
import com.google.analytics.tracking.android.EasyTracker;

public class CompanyDetailActivity extends Activity {

	private MainBean mainBean;

	private TextView companyName;

	private TextView responsibleName;

	private TextView companyLocation;

	private TextView businessAccountingNo;

	private TextView registerOrganizationDesc;

	private void initialize() {
		mainBean = CommonUtil.getMainBeanFormIntent(getIntent());
	}

	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.company_detail_layout);

		initialize();

		setupViews();
	}

	@Override
	public void onStart() {
		super.onStart();

		EasyTracker.getInstance(this).activityStart(this);
	}

	@Override
	public void onStop() {
		super.onStop();

		EasyTracker.getInstance(this).activityStop(this);
	}

	private void setupViews() {
		businessAccountingNo = (TextView) findViewById(R.id.business_accounting_no_contents);

		companyName = (TextView) findViewById(R.id.company_name_contents);

		responsibleName = (TextView) findViewById(R.id.responsible_name_contents);

		companyLocation = (TextView) findViewById(R.id.company_location_contents);

		registerOrganizationDesc = (TextView) findViewById(R.id.register_organization_desc_contents);

		final CompanyBean select = mainBean.getCompanySelect();

		businessAccountingNo.setText(String.format("統一編號：%s",
				select.getBusinessAccountingNo()));

		registerOrganizationDesc.setText(String.format("登記機關：%s",
				select.getRegisterOrganizationDesc()));

		companyName.setText(String.format("公司名稱：%s", select.getCompanyName()));

		responsibleName.setText(String.format("代表人姓名：%s",
				select.getResponsibleName()));

		companyLocation.setText(String.format("公司所在地：%s",
				select.getCompanyLocation()));

	}

}
